<html>

<head>
<meta charset="UTF-8">
<title>部门管理</title>
</head>
<body>
	<#import "/page.ftl" as page />
	<#include "/head.ftl"/>
	<script type="text/javascript" src="/js/user_manage.js"></script>
	<div class="content">
		<div class="tab">
			<div class="tab-header">
				<a href="/user/dept/add" title="添加部门" class="btn btn-setting btn-add" id="add"> <i class="iconfont icon-add"
					style="font-size: 16px;"></i>
				</a>
				<a title="刷新" class="btn btn-setting" onclick="refresh(this)">
					<i class="iconfont icon-refresh"></i>
				</a>
				<div class="tab-tool">
					<input name="key" type="text" placeholder="按名称、电话或邮箱查找...">
					<a onclick="deptSearch()" class="search-btn">
						<i class="iconfont icon-search"></i>
					</a>
				</div>
			</div>
			<div class="tab-content">
				<div>
					<table style="width: 100%; border-collapse: collapse;">
						<tr>
							<#assign sort=dept.sort?replace(': ',',') />
							<th>层级
								<#if sort=='grade,DESC'>
									<a onclick="pageSort('${requestURI}','grade')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='grade,ASC' >
									<a onclick="pageSort('${requestURI}','grade,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','grade')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>名称</th>
							<th>电话</th>
							<th>邮箱</th>
							<th>传真</th>
							<th>上班时段</th>
							<th>规定打卡次数
								<#if sort=='checkDay,DESC'>
									<a  onclick="pageSort('${requestURI}','checkDay')"><i class="iconfont icon-arrowdown"></i></a>
								<#elseif sort=='checkDay,ASC'>
									<a  onclick="pageSort('${requestURI}','checkDay,desc')"><i class="iconfont icon-arrowup"></i></a>
								<#else>
									<a onclick="pageSort('${requestURI}','checkDay')"><i class="iconfont icon-arrowdown"></i></a>
								</#if>
							</th>
							<th>操作</th>
						</tr>
						<#if (dept.content)?size gt 0>
							<#list (dept.content) as dept>
								<tr data-id="${dept.id}">
									<td>${dept.grade}</td>
									<td>${dept.name}</td>
									<td>${dept.tel}</td>
									<td>${dept.email}</td>
									<td>${dept.fax}</td>
									<td>${dept.beginTime}-${dept.endTime}</td>
									<td>${dept.checkDay}</td>
									<td>
										<a class="btn btn-up" onclick="changeGrade(this,'up')"><i class="iconfont icon-up"></i><span>上移</span></a>
										<a class="btn btn-down" onclick="changeGrade(this,'down')"><i class="iconfont icon-down"></i><span>下移</span></a>
										<a href="/user/dept/office?id=${dept.id}" title="查看职位" class="btn btn-look"><i class="iconfont icon-search"></i><span> 查看职位</span></a>
										<a href="/user/dept/getone?id=${dept.id}" title="修改部门" class="btn btn-update"><i class="iconfont icon-brush"></i><span> 修改</span></a>
										<a onclick="deleteOne(${dept.id},'/user/dept/delete')" class="btn btn-delete"><i class="iconfont icon-trash"></i><span> 删除</span></a>
									</td>
								</tr>
							</#list>
						<#else>
							<tr><td colspan="8">没有部门</td></tr>
						</#if>
					</table>
				</div>
			</div>
			<!-- url:路径
				pager：分页对象
				color：分页按钮的颜色
				 -->
			<@page.page url=requestURI pager=dept/>
		</div>
	</div>
</body>
</html>